package com.freeman.cement.util;

import org.springframework.util.ResourceUtils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigUtil {
    public static String readKey(String key) throws IOException {
          Properties properties = new Properties();
          // 使用ClassLoader加载properties配置文件生成对应的输入流
          InputStream in = ResourceUtils.class.getClassLoader().getResourceAsStream("config/config.properties");
          // 使用properties对象加载输入流
          properties.load(in);
          //获取key对应的value值
          return properties.getProperty(key);
    }
}
